package com.fdb.efp.nls.service.common.rules.apply;

import com.fdb.efp.nls.service.common.rules.CheckRule;
import com.fdb.basic.framework.core.constant.BaseConstant;
import com.fdb.basic.framework.core.constant.EsbRetCodeStandard;
import com.fdb.basic.framework.core.exception.BizException;
import com.fdb.efp.nls.service.vo.NlsApplyInfoVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.fdb.basic.framework.core.constant.BaseConstant.NLS_APPLY_STATE_03;

/**
 * 需求编号:2019D08--
 * 问题编号:
 * 开发人员: caoxin
 * 创建日期:2019/12/6
 * 功能描述:
 * 修改日期:2019/12/6
 * 修改描述:
 */
public class ApplySuccessOrFailureRule implements CheckRule {
    private static Logger logger = LoggerFactory.getLogger(ApplySuccessOrFailureRule.class);
    private NlsApplyInfoVO nlsApplyInfoVO;

    public ApplySuccessOrFailureRule(NlsApplyInfoVO nlsApplyInfoVO) {
        this.nlsApplyInfoVO = nlsApplyInfoVO;
    }
    @Override
    public void check() throws BizException {
        if (BaseConstant.NLS_APPLY_STATE_02.equals(nlsApplyInfoVO.getNlsApplyState()) || NLS_APPLY_STATE_03.equals(nlsApplyInfoVO.getNlsApplyState())) {
            if (logger.isErrorEnabled()) {
                logger.error("普税贷用信通知接口 用信申请流水号:【" + nlsApplyInfoVO.getApplySeq() + "】 的用信为通过或拒绝状态继续审批流程!");
            }
            throw new BizException(EsbRetCodeStandard.YWLJCLYC.getValue(), nlsApplyInfoVO.getApplySeq() + " 该用信为通过或拒绝状态 无法继续审批流程!");
        }
    }
}
